跳到主要内容

GetText

Returns the paragraph text.

Syntax

expression.GetText(oPr, oPr.Numbering, oPr.Math, oPr.NewLineSeparator, oPr.TabSymbol);

expression - A variable that represents a ApiParagraph class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oPrRequiredobjectThe resulting string display properties.
oPr.NumberingOptionalbooleanfalseDefines if the resulting string will include numbering or not.
oPr.MathOptionalbooleanfalseDefines if the resulting string will include mathematical expressions or not.
oPr.NewLineSeparatorOptionalstring'\r'Defines how the line separator will be specified in the resulting string.
oPr.TabSymbolOptionalstring'\t'Defines how the tab will be specified in the resulting string (does not apply to numbering).

Returns

string

Example

This example shows how to get the paragraph text.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("\tThis is just a sample text.");
let text = paragraph.GetText({"Numbering": true, "Math": true, "NewLineSeparator": "\r", "TabSymbol": "\t"});
paragraph = Api.CreateParagraph();
paragraph.AddText("The text of the first paragraph: " + text);
doc.Push(paragraph);